package com.yuw.homework04;

public class HourlyEmployee extends ColaEmployee {
    // 属性
    private double hourSalary;
    private double hoursPerMonth;

    // 行为
    public HourlyEmployee() {
    }

    public HourlyEmployee(String employeeName, int employeebirthMonth, double hourSalary, double hoursPerMonth) {
        super(employeeName, employeebirthMonth);
        this.hourSalary = hourSalary;
        this.hoursPerMonth = hoursPerMonth;
    }

    public double getHourSalary() {
        return hourSalary;
    }

    public void setHourSalary(double hourSalary) {
        this.hourSalary = hourSalary;
    }

    public double getHoursPerMonth() {
        return hoursPerMonth;
    }

    public void setHoursPerMonth(double hoursPerMonth) {
        this.hoursPerMonth = hoursPerMonth;
    }

    // 重写计算工资的行为

    @Override
    public double getSalary(int month) {
        // 本月工资
        double moneryPerMonth = super.getSalary(month);
        // 计算工资
        if (this.hoursPerMonth < 160) {
            moneryPerMonth += this.hoursPerMonth * this.hourSalary;
        } else {
            moneryPerMonth += (this.hoursPerMonth - 160) * this.hourSalary * 1.5 + 160 * this.hourSalary;
        }
        return moneryPerMonth;
    }

    @Override
    public void pirntSalary(int currentMoth) {
        System.out.println(this.getEmployeeName() + "工资：" + getSalary(currentMoth));
    }
}
